<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="app">
        <h1>{{phone | formatPhone}}</h1>
        <h1>{{time | formatTime}}</h1>
    </div>
</body>

</html>
<script src="./vue-2.5.21.js"></script>
<script>
    Vue.filter('formatPhone',(p)=>{
        return p.slice(0,3) + "****" + p.slice(-4)
    })
    Vue.filter('formatTime',(t)=>{
        return `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`
    })
    var v = new Vue({
        el: '.app',
        data: {
            phone: '18165247233',
            time: new Date()
        },
        // filters: {
        //      formatPhone(p){ 
        //             return p.slice(0,3) + "****" + p.slice(-4)
        //         },
        //         formatTime(t){
        //             return `${t.getFullYear()}-${t.getMonth()}-${t.getDate()}` ;
        //         }
        //     }
    })
</script>